﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="qlproducttype.ascx.cs" Inherits="admin_qlproducttype" %>
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<asp:Label ID="info" runat="server" Text="Label"></asp:Label>
<center>
<table width="100%">
    <tr>
        <td>Loại: </td>
        <td>
            <asp:DropDownList ID="protype" runat="server" DataSourceID="SqlDataSource1" 
                DataTextField="description" DataValueField="id">
            </asp:DropDownList>
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="<%$ ConnectionStrings:canhbuomxanhconnectionstring %>" 
                SelectCommand="SELECT * FROM [Category]"></asp:SqlDataSource>
        </td>
    </tr>
        <tr>
        <td>Logo: </td>
        <td>
            <asp:FileUpload ID="logo" runat="server" /></td>
    </tr>
    <tr>
        <td>Miêu tả: </td>
        <td>
            <asp:TextBox ID="des" runat="server" Height="87px" TextMode="MultiLine" 
                Width="364px"></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td colspan="2"><center><asp:Button runat="server" ID="addbt" Text="Thêm" 
                onclick="addbt_Click"/></center></td>
    </tr>
</table>
</center>
<br />
Loại
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" 
    DataSourceID="SqlDataSource1" DataTextField="description" DataValueField="id" 
    onselectedindexchanged="DropDownList1_SelectedIndexChanged">
</asp:DropDownList>
<br />
<br />
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
        AutoGenerateColumns="False" AllowSorting="True"
        CellPadding="4" ForeColor="#333333" GridLines="None"
        PageSize="5" Width="100%" onrowcreated="GridView1_RowCreated" 
        onrowediting="GridView1_RowEditing" 
    DataSourceID="SqlDataSource2" EnableModelValidation="True" 
    onrowdeleting="GridView1_RowDeleting" DataKeyNames="id" 
    onrowcommand="GridView1_RowCommand">
        <RowStyle BackColor="#EFF3FB" VerticalAlign="Middle" />
        <EmptyDataRowStyle VerticalAlign="Middle" />
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="White" ForeColor="#459300" HorizontalAlign="Center" />
        <EmptyDataTemplate>
             <asp:Label ID="Label3" runat="server" Text="Chưa có dữ liệu"></asp:Label>
        </EmptyDataTemplate>
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        <HeaderStyle BackColor="#57A000" Font-Bold="True" ForeColor="White" />
        <Columns>
            <asp:TemplateField HeaderText="id" SortExpression="id" Visible="False">
                <EditItemTemplate>
                    <asp:Label ID="id" runat="server" Text='<%# Eval("id") %>'></asp:Label>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="id" runat="server" Text='<%# Bind("id") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="categoryId" HeaderText="categoryId" Visible = "false"
                SortExpression="categoryId" ItemStyle-HorizontalAlign="Center">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
            </asp:BoundField>
            <asp:BoundField DataField="description" HeaderText="Miêu tả" ItemStyle-HorizontalAlign="Center"
                SortExpression="description" >
<ItemStyle HorizontalAlign="Center"></ItemStyle>
            </asp:BoundField>
            <asp:CommandField ButtonType="Button" EditText="Sửa" ShowEditButton="True"  
                ItemStyle-HorizontalAlign="Center">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
            </asp:CommandField>
            <asp:TemplateField ShowHeader="False">
                <ItemTemplate>
                    <asp:Button ID="Button1" runat="server" CausesValidation="true" 
                        CommandName="Delete" Text="Xoá" OnClientClick="return confirm('Bạn thật sự muốn xóa dữ liệu này?')" />
                </ItemTemplate>
                <ItemStyle HorizontalAlign="Center" />
            </asp:TemplateField>
            <asp:ButtonField ButtonType="Button" CommandName="addlang" Text="Ngôn ngữ"  
                ItemStyle-HorizontalAlign="Center">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
            </asp:ButtonField>
        </Columns>
        <EditRowStyle BackColor="#003366" VerticalAlign="Middle" />
        <AlternatingRowStyle BackColor="White" />
    </asp:GridView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" 
    ConnectionString="<%$ ConnectionStrings:canhbuomxanhconnectionstring %>" 
    SelectCommand="SELECT * FROM [ProductType] WHERE ([categoryId] = @categoryId)">
    <SelectParameters>
        <asp:ControlParameter ControlID="DropDownList1" Name="categoryId" 
            PropertyName="SelectedValue" Type="Int64" />
    </SelectParameters>
</asp:SqlDataSource>

